package leetcode.weekly.week331;

//Solution2Test
public class Solution2 {

	public int[] vowelStrings(String[] words, int[][] queries) {
		int len = words.length;
		int[] s = new int[len + 1];
		for (int i = 1; i <= len; i++) {
			String word = words[i - 1];
			s[i] = s[i - 1];
			if ("aeiou".indexOf(word.charAt(0)) >= 0 && "aeiou".indexOf(word.charAt(word.length() - 1)) >= 0) {
				s[i]++;
			}
		}
		int[] ans = new int[queries.length];
		for (int i = 0; i < ans.length; i++) {
			int[] q = queries[i];
			int l = q[0], r = q[1];
			ans[i] = s[r + 1] - s[l];
		}
		return ans;
	}
}
